<?php
// +----------------------------------------------------------------------
// | EtrolPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Author: Author: LJQ <245369209@qq.com> 
// +----------------------------------------------------------------------

namespace app\admin\controller\ajax;
//公司关联下拉菜单值

class Enterprise {
	/**
	 * 负责人下拉菜单
	 * @param string $id
	 * @return \think\response\Json
	 */
	public function getChargePersonList($id = null){
		$where = [];
		if($id){
			$where['enterpriseId'] = $id;
		}
		$chargePersonList = db('staff')->where($where)->field('staffName as name,id')->select();
		return json($chargePersonList);
	}
	
	/**
	 * 危险源下拉菜单
	 * @param string $id
	 * @return \think\response\Json
	 */
	public function getDangerSourceList($id = null){
		$where = [];
		if($id){
			$where['enterpriseId'] = $id;
		}
		$dangerSourceList = db('dangersource')->where($where)->field('name,id')->select();
		return json($dangerSourceList);
	}
	
	public function getStoreList($id = null){
		$where = [];
		if($id){
			$where['enterpriseId'] = $id;
		}
		$storeList = db('store')->where($where)->field('storeName as name,id')->select();
		return json($storeList);
	}
}